package app.main;

import puri01.game.GamePlatform;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Display;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import app.game.resource.Resource;
import app.game.stage.GameStage;
import app.menu.Menu_GameStart;
import app.menu.PJManager;

public class Main extends Activity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		Resource.getInstance().setContext(this);
		setDisplay();
		setContext();

		_GamePlatform = new GamePlatform(this);
		_GamePlatform.setUseKeyEvent(true);
		_GamePlatform.setUseMotionEvent(true);
		_GamePlatform.setLayoutParams(new LinearLayout.LayoutParams(
				ViewGroup.LayoutParams.FILL_PARENT,
				ViewGroup.LayoutParams.FILL_PARENT, 0.0F));
		setContentView(_GamePlatform);

		PJManager.getInstance().setGameControlGroup(
				_GamePlatform.getGameControlGroup());
		PJManager.getInstance().begin(null);
	}

	public void setDisplay() {
		Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
				.getDefaultDisplay();
		GameStage.dis = display;
		Menu_GameStart.display = display;
	}
	private void setContext() {
		Context context = getApplicationContext();
		GameStage.con = context;
		Menu_GameStart.mContext = context;
	}

	private GamePlatform _GamePlatform = null;

}